]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
shell-app: Stay consistent about application states
authorJasper St. Pierre <jstpierre@mecheye.net>
Thu, 16 Jul 2015 22:56:00 +0000 (15:56 -0700)
committerJasper St. Pierre <jstpierre@mecheye.net>
Fri, 17 Jul 2015 00:09:39 +0000 (17:09 -0700)
When the last interesting window of an app-backed window is removed,
we'll transition it back to STOPPED, but we transition the state and
send out the signal before we clear the running state.

This means that any listeners to the state-changed signal might
encounter a window-backed app that has a running state, but no
windows. If they call, e.g. shell_app_get_name, while in this state,
they'll encounter an assertion fail.

src/shell-app.c

index ca367b12e76b721b7dc03bd8db1e8f484ec9b722..c33807faa3bc65d3b174e8c488ae26b494e58a0a 100644 (file)
@@ -1003,10 +1003,16 @@ _shell_app_remove_window (ShellApp   *app,
 
   if (!meta_window_is_skip_taskbar (window))
     app->running_state->interesting_windows--;
-  shell_app_sync_running_state (app);
 
-  if (app->running_state && app->running_state->windows == NULL)
-    g_clear_pointer (&app->running_state, unref_running_state);
+  if (app->running_state->windows == NULL)
+    {
+      g_clear_pointer (&app->running_state, unref_running_state);
+      shell_app_state_transition (app, SHELL_APP_STATE_STOPPED);
+    }
+  else
+    {
+      shell_app_sync_running_state (app);
+    }
 
   g_signal_emit (app, shell_app_signals[WINDOWS_CHANGED], 0);
 }